package org.example.chat.entity;

import lombok.Data;
import org.example.chat.validate.groups.AddGroup;
import org.example.chat.validate.groups.UpdateGroup;
import org.hibernate.annotations.Comment;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
@Entity
@Table(name = "chat_group")
public class Group implements Serializable {
    private static final long serialVersionUID = 1L;

    @Null(message = "id必须为空", groups = {AddGroup.class})
    @NotEmpty(message = "id 不能为空", groups = {UpdateGroup.class})
    @Id
    @Column(name = "id")
    @Comment("群聊id")
    private String id;

    @NotEmpty(message = "群名不能为空", groups = {AddGroup.class})
    @Column(name = "group_name", nullable = false, length = 50)
    @Comment("群聊名称")
    private String name;


    @Column(name = "group_owner_id", nullable = false)
    @Comment("群主id")
    private String groupOwnerId;

    @Column(name = "note")
    @Comment("备注")
    private String note;

    @Column(name = "status")
    @Comment("群聊状态， 0: 正常 1：锁定 2：永久封禁")
    private Integer status;

    @Column(name = "create_date")
    @Comment("创建时间")
    private LocalDate createDate;
}
